﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.ServiceModel.Channels;

namespace FlightSearchServer
{
    class CacheOperationBehaviorAttribute : Attribute, IOperationBehavior
    {
        public void ApplyDispatchBehavior(OperationDescription operationDescription, DispatchOperation dispatchOperation)
        {
            //Get the instance of the default invoker
            IOperationInvoker invoker = dispatchOperation.Invoker;
            //Override with cache based invoker
            dispatchOperation.Invoker = new CacheOperationInvoker(invoker);
        }

        public void AddBindingParameters( OperationDescription operationDescription, BindingParameterCollection bindingParameters) { }

        public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation) { }

        public void Validate(OperationDescription operationDescription) { return; }
    }
}
